<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">
    <head>
        <title><ui:insert name="header">Tree Viewer</ui:insert></title>
    </head>
    <body>
        <h:form>
            <rich:dataGrid value="#{viewer.trees}" var="treetypes" columns="3" elements="6" width="600px">
                <rich:panel bodyClass="pbody">
                    <f:facet name="header">
                        <h:outputText value="#{treetypes.forrestid.name} -  #{treetypes.name}"></h:outputText>
                    </f:facet>
                    <h:panelGrid>
                        <h:outputText escape="false" value="#{treetypes.description}"/>
                    </h:panelGrid>
                </rich:panel>
                <f:facet name="footer">
                    <rich:datascroller></rich:datascroller>
                </f:facet>
            </rich:dataGrid>
            <h:panelGrid columns="2" columnClasses="top 70per, top 30per" width="100%">
                <rich:orderingList listHeight="300" listWidth="400"
                                   value="#{viewer.trees}" var="treetypes"
                                   selection="#{viewer.selectedTree}">
                    <!-- Forrest Name Column -->
                    <rich:column  width="180">
                        <f:facet name="header">
                            <h:outputText value="Forrest Name"/>
                        </f:facet>
                        <h:outputText value="#{treetypes.forrestid.name}"/>
                    </rich:column>
                    <!-- Forrest Name Column (end) -->

                    <!-- Tree Type Column -->
                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Tree Type"/>
                        </f:facet>
                        <h:outputText value="#{treetypes.name}"/>
                    </rich:column>
                    <!-- Tree Type Column (end) -->
                    <a4j:support event="onclick" ignoreDupResponses="true" requestDelay="500" action="#{viewer.takeSelection}" reRender="output"/>
                </rich:orderingList>
                <rich:panel id="output" header="Current Selection" style="width:200px">
                    <h:outputText value="BEBE"/>
                </rich:panel>
            </h:panelGrid>
        </h:form>
    </body>
</html>

